chore: ensure consistent use of semicolons#11170
Conversation
|
@Planeshifter I am not actually sure the proposed changes are desired. See https://gcc.gnu.org/onlinedocs/cpp/Swallowing-the-Semicolon.html. |
|
Also, your OP is not correct. Most contributors have never seen the macro definitions, so the auto-generated rationale is misleading. The semicolons were added in the examples explicitly because of what is discussed in the GCC guide. Namely, because these macros look like function calls, it can minimize confusion to treat them like function calls. So, I would argue that the docs are actually correct. Now, that leaves whether it is "necessary" to include a trailing semicolon in, say, |
Remove trailing semicolons from NAPI module registration macro invocations in 11 addon.c files to match the established codebase convention used by the other ~783 files. The macros (e.g., STDLIB_MATH_BASE_NAPI_MODULE_D_D) expand to complete function definitions ending with NAPI_MODULE(), so a trailing semicolon is unnecessary. While functionally harmless, these were inconsistent with the rest of the codebase.
a5bfde3 to
4ac7969
Compare
|
@Planeshifter See, e.g., https://github.com/stdlib-js/stdlib/blob/develop/lib/node_modules/%40stdlib/blas/ext/base/dapx/src/addon.c#L36 where we include semicolons, and for good reason, because when you stack macro calls, a semicolon can prevent unintended "merging" of macro contents. |
|
This is a decent example of a scenario where it is beneficial to have a bit more understanding of what is going on before accepting LLM output. |
|
PR was not ready for review and has meanwhile been updated. |
Coverage Report
The above coverage report was generated for the changes in this PR. |
lib/node_modules/@stdlib/stats/base/dists/binomial/mgf/src/addon.c
Outdated
Show resolved
Hide resolved
Signed-off-by: Athan <kgryte@gmail.com>
Description
This pull request:
addon.cfiles that had them after NAPI module registration macro invocations, inconsistent with the other ~783 files.The macros (e.g.,
STDLIB_MATH_BASE_NAPI_MODULE_D_D) expand to complete function definitions ending withNAPI_MODULE(), so a trailing semicolon is unnecessary. While functionally harmless (it produces an empty declaration at file scope), these 11 files were inconsistent with the rest of the codebase.Related Issues
No.
Questions
No.
Other
No.
Checklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?
Disclosure
This PR was written primarily by Claude Code. Claude audited all ~800 addon.c files for semicolon inconsistencies, identified the 11 violations, and applied the fixes.
@stdlib-js/reviewers